package rule

import "reflect"

func init() {
	Register(&arrayRule{})
}

type arrayRule struct{}

func (a *arrayRule) Name() string {
	return "array"
}

func (a *arrayRule) Check(in *RuleInput) (err error) {
	if in.Kind == reflect.Map || in.Kind == reflect.Slice || in.Kind == reflect.Array {
		return nil
	}
	kind := reflect.ValueOf(in.Value).Kind()
	if kind == reflect.Map || kind == reflect.Slice || kind == reflect.Array {
		return nil
	}
	return in.Error()
}
